package com.mccken.designpattern.factory.abstract_factory.demo1;

import com.mccken.designpattern.factory.abstract_factory.demo1.new_factory.FactoryD;
import com.mccken.designpattern.factory.abstract_factory.demo1.product_c.FactoryA22;
import com.mccken.designpattern.factory.abstract_factory.demo1.product_c.FactoryC2;
import com.mccken.designpattern.factory.abstract_factory.demo1.product_c.IFactory2;
import com.mccken.designpattern.factory.abstract_factory.demo1.product_c.IProductC;

/**
 * @program: mccken-collect
 * @description:
 * @author: mccken
 * @create: 2023-04-13 00:29
 **/
public class Client {
	public static void main(String[] args) {
		IFactory factoryA = new FactoryA();
		factoryA.createProductA().doA();
		factoryA.createProductB().doB();

		IFactory factoryB = new FactoryB();
		factoryB.createProductA().doA();
		factoryB.createProductB().doB();

		System.out.println("新增了工厂D之后");
		IFactory factoryD = new FactoryD();
		factoryD.createProductA().doA();
		factoryD.createProductB().doB();

		System.out.println("新增了产品C之后");

		IFactory2 factory2A = new FactoryA22();
		factory2A.createProductC().doC();

		IFactory2 factory2C = new FactoryC2();
		factory2C.createProductC();
		factory2C.createProductA().doA();
		factory2C.createProductB().doB();
		
		class ProductCFactoryB implements IProductC {
		
			@Override
			public void doC() {
				System.out.println("ProductC of FamilyB");
			}
		}

		IProductC productC = new ProductCFactoryB();
		
	}
}
